<?php

class ListPasswordsForm extends AbstractForm {
	const NAME = 'list';

	public function process() {
		return KeyGenius::listPasswords($this->getValue('token'));
	}

	public function getTitle() {
		return 'List password';
	}

	public function getDescription() {
		return 'List the sites you have stored passwords for.';
	}

	public function configure() {
		$this->setWidgets(array(
			'token'		=> new sfWidgetFormInput(),
		));

		$this->widgetSchema->setNameFormat(self::NAME.'[%s]');

		$this->setValidators(array(
			'token'		=> new sfValidatorRegex(array('pattern' => self::OTP_PATTERN)),
		));
	}
}

?>
